from locust import HttpLocust,TaskSet,task
import json
import requests
#TaskSet类.
class UserBehavior(TaskSet):
    def on_start(self):
        pass

    def login(self):
        login_url = "https://www-api2.gpmine.com/v2/user/auth/login"
        login_data = {
            "name": "15986673013", "password": "111111"
        }
        login_response = self.client.post(url=login_url, data=login_data)
        print(login_response)

        # @task()
        # def login1(self):
        #     rooms_url = 'https://live-zull-aiccp.xiyizb.com/player/1.0/getAnchorRooms'
        #     rooms_headers = {'token': self.token}
        #     rooms_response = requests.get(url=rooms_url, headers=rooms_headers)
        #     rooms_response.status_code
        #
        #     with self.client.post(url=rooms_url, headers=rooms_headers) as response1:
        #
        #
        #     with self.client.post(url=rooms_url, headers=rooms_headers) as response:
        #         print(response.)
        #         print(response.status_code)
        #
        #         print(response.content)




class MobileUserLocust(HttpLocust):
    weight = 3
    task_set = UserBehavior
    min_wait = 3000
    max_wait = 6000